;›;**************************************›;›; CFMT: CUSTOM FORMAT TRACK›;›; ENTRY:ACC CONTAINS TIME FOR 1 TRACK›; :TIME= ACC * 1.024MSEC›; :IT IS ASSUMED THAT THE BUFFER›; :STARTS AT $2000›; :BUFFER WAS LOADED USING THE›; :THE DOWNLOAD COMMAND›; :AUX1 AND AUX2 CONTAIN #OF BYTES›; :USES BPNT TO POINT TO BUFFER›; :SETUP THE DENSITY LINE ON THE›; :FDC FOR SINGLE DENSITY ON ENTRY›; :RETURNS IT TO WHAT EVER ON EXIT›; EXIT:NONE, DOES NOT CHECK FOR ANY›; :ERRORS›;›;**************************************›;›CFMTPROC›;›:STATUS=$A0›:TIME=$A1›:TRYS=$A2›;›STA:TIME›LDA#$00›STA:TRYS;INT RETRY COUNTER›;›;CHECK TO SEE IF DOOR IS OPEN›;›BPL:CFT01›BVC:CFT01›LDA#$01;SET ERROR STATUS›JMP:CFTXT;EXIT ROUTINE›;›:CFT01LDY#$00›LDA#$00;SET UP BPNT TO POINT TO›STABPNT;CUSTOM DATA IN TRACK BUFFER›LDA#$20›STABPNT+1›CLC;CLEAR CARRY FOR ADD›LDABPNT›ADCCMDFRM+2›STACMDFRM+2›LDABPNT+1›ADCCMDFRM+3›STACMDFRM+3;END OF FORMAT BUFFER›LDA(BPNT),Y›JSRIBPNT;INCREMENT POINTER›STADTAREG;FIRST BYTE OF TRACK DATA›LDA#1›STAWT24E;START TIMER TO GEN IP›LDX#$10›:LOOPDEX›BNE:LOOP;JUST DELAY A BIT, HUMOR ME›LDA#$F0;FORMAT COMMAND›STACMDREG›:WAITBITDRA;WAIT FOR FIRST DRQ›BPL:WAIT›LDA(BPNT),Y›STADTAREG;PUT DATA INTO DATA REG›JSRIBPNT;INCREMENT POINTER›:WAIT1BITDRA;WAIT FOR SECOND DRQ›BPL:WAIT1›LDA(BPNT),Y›STADTAREG›LDAWT64D;CLEAR IP PULSE›LDA:TIME;SET TIME FOR DISK ROTATION›STAWT24E;ACCORDINT TO UPLOADED TIME›JSRIBPNT;INCREMENT POINTER›:LOOP1BITDRA;WAIT FOR DRQ›BVC:CFTER;TIMEOUT ERROR, RETRY›BPL:LOOP1›LDA(BPNT),Y›STADTAREG›JSRIBPNT;INCREMENT BPNT›LDABPNT+1;END OF BUFFER?›CMPCMDFRM+3›BCC:CFT02›BNE:CFT02›LDABPNT›CMPCMDFRM+2›:CFT02BNE:LOOP1›LDA#$01;MASK FOR BUSY›LDX#0;DATA TO DISK›:CFT03ANDSTREG;FDC BUSY?›BEQ:CFT04;DONE›BITDRA;WAIT FOR DATA REQUEST›BPL:CFT03;WAIT FOR DRQ›STXDTAREG›BMI:CFT03›:CFT04LDASTREG›AND#$04;CHECK FOR LOST DATA›BEQ:CFT05;TRACK OK, WE HOPE›:CFTERLDAWT64D;CLEAR IP›JSRFINT;CLEAR FDC›INC:TRYS;INCREMENT RETRYS›LDA#$06›CMP:TRYS;SIX TIMES?›BEQ:CFT06›JMP:CFT01;NOPE TRY AGAIN›;›:CFT06LDA#$01›STA:STATUS;SET BAD STATUS›BNE:CFTXT;GOODBY›:CFT05LDA#0›STA:STATUS;GOOD STATUS›:CFTXTJSRFINT›RTS›EPROC›;›;›;**************************************›;›; IBPNT: INCREMENT BPNT›;›; ENTRY:NONE›; EXIT:BPNT INCREMENTED BY ONE›;›;**************************************›;›IBPNTPROC›;›INCBPNT›BNE:IBPTX;INCREMENT IF NO OVER FLOW›INCBPNT+1›:IBPTXRTS›EPROC›;›;›;**************************************›;›; CSSK: CHECK SECTOR SKEWING›;›; PROGRAM LOOKS AT TRACK 0 AND ATTEMPTS›; TO DETERMINE WHAT THE SECTOR SKEW IS›; PUTS INFO INTO TABLE USED BY RDTK TO›; MAXIMIZE THE SPEED AT WHICH THIS›; HAPPENS. IF NO SENSE CAN BE MADE OUT›; OF TRACK ZERO, THEN A DEFAULT SECTOR›; SKEW IS PUT IN TABLE›; ENTRY:NONE›; EXIT:SKEW TABLE IS SET UP›; USES:ALL REGISTERS›; :MEMORY ON PAGE $20›; :ZERO PAGE $A0$AF›; :CALLS RADR›;›;**************************************›;›CSSKPROC›;›:STATUS=$A0›:TRYS=$AF;NUMBER OF RETRYS›;›;FIRST CHECK TO SEE WHAT FORMAT›;›LDA#$FF›STATINB;BUFFER EMPTY›LDADCKFLG›BEQ:CSK31›JMP:CSK04›:CSK31JSRFINT›LDA#$00;GO TO TRACK ZERO›STANTRK›JSRSKTK›JSRRESTOR›JSRFINT›LDA#$20;PUT INTO SINGLE DENSITY›ORADRA;SET BIT HIGH›STADRA›JSRRADR›BCS:CSK01;NOT SINGLE DENSITY›LDA#$80;SET LENTH TO 128 BYTES›STALENTH›STACONFIG+7›LDA#$00›STACONFIG+6›LDA#$FB›ANDCONFIG+5;PUT IS SD MODE›STACONFIG+5›LDA#18›STACONFIG+3;SECTORS PER TRACK›LDASTAT›AND#%01011111›STASTAT›JMP:CSK02;OK, NOW MAKE SKEW TABLE›;›;CHECK FOR DOUBLE DENSITY›;›:CSK01LDA#$DF;PUT INTO DBL DENSITY›ANDDRA;CLEAR BIT LOW›STADRA›JSRRADR;CHECK DISK›BCC:CSK11›JMP:BDISK;BAD DISK, SET DEFAULTS›;›;OK IT IS A DD DISK, BUT WHAT FLAVOR›;›:CSK11JSRRADR;CHECK DISK AGAIN›LDATADRES+2;GET SECTOR NUMBER›CMP#4›BCC:CSK11;LESS THAN 4›LDATADRES+3›BEQ:CSK21;THIS IS A DUAL DENS DISK›;›;DOUBLE DENSITY DISK›;›LDA#$00;SET LENTH TO 256›STALENTH›STACONFIG+7›LDA#$01›STACONFIG+6;SET CONFIG LENTH›LDA#$04›ORACONFIG+5;SET STATUS FOR DD›STACONFIG+5›LDASTAT›AND#%01011111;MASK DENSITY›ORA#%00100000;SET DOUBLE DENS›STASTAT›LDA#18›STACONFIG+3›JMP:CSK02›;›:CSK21LDA#$80;SET LENTH TO 128›STALENTH›STACONFIG+7›LDA#$00›STACONFIG+6;SET CONFIG LENTH›LDA#$04›ORACONFIG+5;SET STATUS FOR DD›STACONFIG+5›LDASTAT›AND#%01011111;MASK DENSITY›ORA#%10000000;SET DUEL DENS›STASTAT›LDA#26›STACONFIG+3›;›;BUILD SKEW TALBE›;›:CSK02LDA#$00›JSRFDCCK;CHECK FDC TYPE›LDA#$06;SET TRYS TO SIX›STA:TRYS›:LOOP1LDX#0;INDEX INTO SKEW TALBE›:LOOPJSRRADR;READ ADRESS OF SECTOR›BCC:CSK03;GOOD READ›DEC:TRYS;BAD READ DEC RETRYS›BNE:LOOP1;RETRY WHOLE THING›JSRDFLTS;MAKE DEFALT SKEW TABLE›LDA#$01›STA:STATUS›SEC›BCS:CSKXT;BUMP OUT›;›:CSK03LDATADRES+2;GET SECTOR NUMBER›STASKTAB,X;STORE IN SKEWTABLE›INX›CPXCONFIG+3;ALL SECTORS FETCHED?›BNE:LOOP;NOPE NOT YET›;›JSRCST;CHECK SKEW TABLE FOR BOO-BOO›BCC:CSK04;GOOD TABLE›DEC:TRYS;BAD READ DEC TRYS›BNE:LOOP1›JSRDFLTS;MAKE DEFAULT SKEW TABLE›LDA#$01›STA:STATUS›SEC›BCS:CSKXT;BUMP OUT›;›:BDISKJSRDFLTS;MAKE DEFALT SKEW TAB›LDA#$20›ORADRA;PUT INTO SINGLE DENSITY›STADRA›LDA#$01›STA:STATUS›SEC›BCS:CSKXT›;›:CSK04LDA#$00›STA:STATUS›CLC›;›:CSKXTRTS›EPROC›;›;›;**************************************›;›; RESTOR: CHECKS TRACK ZERO›; : ALSO UPDATES STATUS FLAGS›;›; ENTRY:NONE›; EXIT:CARRY SET IF NOTHING FOUND›;›;**************************************›;›RESTORPROC›;›:STATUS=$A0›;›LDA#$D0;SET TIME OUT›STAWT24E›LDA#%00001100;RESTORE COMMAND›STACMDREG›JSRDELAY›:LOOPLDA#$01›BITSTREG›BMI:RES01›BEQ:RES01›BITDRA;CHECK TIME OUT›BVC:RES11›JMP:LOOP›;›:RES11LDARTDE;CLEAR INTERRUPT›LDASTREG›AND#$01›BEQ:RES01;NOT BUSY›LDA#$D0›STAWT24E›;›:RES01LDASTREG›STATEMP›EOR#$FF›STASTAT+1›EOR#$FF›AND#$40;CHECK WRITE PROTECT›LSRA›LSRA›LSRA›STATEMP›LDA#$F7›ANDSTAT›ORATEMP›STASTAT›LDASTREG›AND#$10;CHECK FOR SEEK ERROR›BEQ:RES02›SEC›LDA#$01›STA:STATUS›JMP:RESXIT›:RES02LDA#$00›STA:STATUS›CLC›:RESXITRTS›EPROC›;›;›;**************************************›;›; DFLTS:MAKE DEFALT SECTOR TABLE›;›; ENTRY: CHECKS STAT FOR DENSITY›; EXIT: SKTAB SET TO DEFUALT›;›;**************************************›;›DFLTSPROC›;›:SCNT=$AE›;›;SAVE BPNT JUST IN CASE›;›LDABPNT›PHA›LDABPNT+1›PHA›;›LDA#$20;CHECK STATUS›BITSTAT›BMI:DFTHD;WE HAVE HALF DENSITY›BNE:DFTDD;WE HAVE DOUBLE DENSITY›;›;WE HAVE SINGLE DENSITY›;›LDA#LOW :DTABS›STABPNT›LDA#HIGH :DTABS›STABPNT+1›LDA#18›STA:SCNT;SET SECTOR COUNT TO 18›JMP:DFT01›;›:DFTHDLDA#LOW :DTABH›STABPNT›LDA#HIGH :DTABH›STABPNT+1›LDA#26›STA:SCNT›JMP:DFT01›;›:DFTDDLDA#LOW :DTABD›STABPNT›LDA#HIGH :DTABD›STABPNT+1›LDA#18›STA:SCNT›;›:DFT01LDY#$00;SET INDEX›LDX#0›:LOOPLDA(BPNT),Y;GET DEFAULT SECTOR›STASKTAB,X;STORE IN SKEW TABLE›INY›INX›CPX:SCNT;ALL POSITIONS?›BNE:LOOP›PLA›STABPNT+1›PLA›STABPNT›RTS›;›:DTABSDB17,15,13,11,9,7,5,3,1›DB18,16,14,12,10,8,6,4,2›:DTABDDB18,17,16,15,14,13,12,11,10›DB9,8,7,6,5,4,3,2,1›:DTABHDB1,3,5,7,9,11,13,15,17,19,21›DB23,25,2,4,6,8,10,12,14,16,18,20›DB22,24,26›;›EPROC›;›;**************************************›;›; CST: CHECK SKEW TABLE FOR ERRORS›;›; MAKE SURE THAT EACH ELEMENT OF›; SKEW TABLE IS UNIQUE›;›; ENTRY:NONE›; EXIT:CARRY SET IF ERROR›;›;**************************************›;›CSTPROC›;›:TEMP=$A1›;›; X-REG CONTAINS THE SEARCH INDEX›; Y-REG CONTAINS THE CURRENT INDEX›;›LDACONFIG+3›STA:TEMP›DEC:TEMP›LDX#1›LDY#0;INIT BOTH INDEXES›:LOOP1LDASKTAB,Y;GET CURRENT VALUE›:LOOPCMPSKTAB,X;EQUAL TO ANY OTHER?›BEQ:YUK;YUK, DUPLICATE›INX;INCREMENT Y REG›CPXCONFIG+3;WHOLE TABLE?›BNE:LOOP›INY;INC CURRENT INDEX›TYA;MOVE Y TO X›TAX›INX;POINT TO NEXT VALUE IN TABLE›CPY:TEMP;ALL VALUES CHECKED?›BNE:LOOP1›CLC;SET GOOD JOB›BCC:CSTXT›;›:YUKSEC›:CSTXTRTS›;›EPROC›;›;*************************************›;›; DDTRK : CREATE DOUBLE DENSITY TRACK›; IMAGE FOR FORMATTING›;›; ENTRY : SECT IS SECTOR #›; TRCK IS TRCK #›; EXIT : MODEL TRACK AT $2000›;›;*************************************›;›DDTRKPROC›;›:TRACK=$A0›;›STA:TRACK;SAVE TRACK NUMBER›LDA#$00;SET UP BPNT›STABPNT›LDA#$20›STABPNT+1›;›;START BUILDING THE TRACK›;›LDA#$4E;DATA›LDX#80;80 BYTES›JSRBB›LDA#0›LDX#12›JSRBB;12 ZEROS›LDA#$F6;WRITES C2›LDX#3;THREE TIMES›JSRBB›LDA#$FC›LDX#1;ONE INDEX AM›JSRBB›LDA#$4E;DATA›LDX#50›JSRBB›;›;TRACK PREAMBLE DONE, NOW FOR THE›;SECTORS›;›LDA#$00›STASECT;INIT SECTOR INDEX›:LOOPLDA#0›LDX#12;12 ZEROS›JSRBB›LDA#$F5;WRITES A1›LDX#3;THREE TIMES›JSRBB›LDA#$FE;ID AM›STA(BPNT),Y›JSRIBPNT›LDA:TRACK›STA(BPNT),Y›JSRSTKP;STORE TRACK POINTER›JSRIBPNT›LDA#0›STA(BPNT),Y;SIDE NUMBER›JSRIBPNT›LDXSECT›LDASKTAB,X;GET SECTOR NUMBER›STA(BPNT),Y›JSRIBPNT›LDXSECT›LDASKTAB,X;GET SECTOR›LDX:TRACK›JSRSL;DO SECTOR LENTH CALC›PHA;SAVE ACCUMULATOR›LDA#$F7;CAUSES 2 CRC BYTES›STA(BPNT),Y›JSRIBPNT›LDA#$4E›LDX#22;GAP ID›JSRBB›LDA#$00›LDX#12›JSRBB›LDA#$F5›LDX#3›JSRBB;WRITE 3 $A1›LDA#$FB›STA(BPNT),Y›JSRIBPNT›;›;WRITE SECTOR BLOCK›;›PLA;GET SECTOR LENTH›TAX›LDA#$40;DATA FOR SECTOR›JSRBB›LDA#$F7;WRITE 2 CRC BYTES›STA(BPNT),Y›JSRIBPNT›LDA#$4E›LDX#16›JSRBB›INCSECT;INCREMENT SECTOR INDEX›LDASECT›CMP#18;EIGHTEEN SECTORS?›BEQ:EXIT›JMP:LOOP›:EXITLDA#$B7;END OF DD TRACK MARK›STA(BPNT),Y›RTS›EPROC›;›;*************************************›;›;DUTRK : CREATE DUAL DENSITY TRACK›; IMAGE FOR FORMATTING›;›; ENTRY : SECT IS SECTOR #›; TRCK IS TRCK #›; EXIT : MODEL TRACK AT $2000›;›;*************************************››DUTRKPROC›;›:TRACK=$A0›;›STA:TRACK;SAVE TRACK NUMBER›LDA#$00;SET UP BPNT›STABPNT›LDA#$20›STABPNT+1›;›;START BUILDING THE TRACK›;›LDA#$4E;DATA›LDX#80;80 BYTES›JSRBB›LDA#0›LDX#12›JSRBB;12 ZEROS›LDA#$F6;WRITES C2›LDX#3;THREE TIMES›JSRBB›LDA#$FC›LDX#1;ONE INDEX AM›JSRBB›LDA#$4E;DATA›LDX#50›JSRBB›;›;TRACK PREAMBLE DONE, NOW FOR THE›;SECTORS›;›LDA#$00›STASECT;INIT SECTOR INDEX›:LOOPLDA#0›LDX#12;12 ZEROS›JSRBB›LDA#$F5;WRITES A1›LDX#3;THREE TIMES›JSRBB›LDA#$FE;ID AM›STA(BPNT),Y›JSRIBPNT›LDA:TRACK›STA(BPNT),Y›JSRSTKP;STORE TRACK POINTER›JSRIBPNT›LDA#0›STA(BPNT),Y;SIDE NUMBER›JSRIBPNT›LDXSECT›LDASKTAB,X;GET SECTOR NUMBER›STA(BPNT),Y›JSRIBPNT›LDA#$00›STA(BPNT),Y;SECTOR LENTH=128›JSRIBPNT›LDA#$F7;CAUSES 2 CRC BYTES›STA(BPNT),Y›JSRIBPNT›LDA#$4E›LDX#22;GAP ID›JSRBB›LDA#$00›LDX#12›JSRBB›LDA#$F5›LDX#3›JSRBB;WRITE 3 $A1›LDA#$FB›STA(BPNT),Y›JSRIBPNT›;›;WRITE SECTOR BLOCK›;›LDX#128;128 BYTE SECTOR›LDA#$40;DATA FOR SECTOR›JSRBB›LDA#$F7;WRITE 2 CRC BYTES›STA(BPNT),Y›JSRIBPNT›LDA#$4E›LDX#16›JSRBB›INCSECT;INCREMENT SECTOR INDEX›LDASECT›CMP#26;TWENTY SIX SECTORS?›BEQ:EXIT›JMP:LOOP›:EXITLDA#$B7;END OF DD TRACK MARK›STA(BPNT),Y›RTS›EPROC›;›;*************************************›;›; SL: CALCUTLATE SECTOR LENTH›;›; ENTRY:A = SECTOR›; :X = TRACK›; EXIT:ACC = LENTH (0=256)›; :SECTOR LENTH PUT IN TABLE›; :BPNT IS INCREMENTED›;›;*************************************›;›SLPROC›;›CPX#0;TRACK 0?›BEQ:SL001;YES CHECK FOR SECTOR 1->3›:SL002LDA#01›LDY#$00›STA(BPNT),Y›JSRIBPNT›LDA#$00;SECTOR LENTH 256›BEQ:SLXIT;LEAVE›;›:SL001CMP#4;SECTOR >= 4?›BCS:SL002;YES›;›;OK, THIS ONE IS 128 BYTES LONG›;›LDA#0›TAY›STA(BPNT),Y›JSRIBPNT›LDA#$80;128 TO SEND BACK›:SLXITRTS›EPROC›;›;›;*************************************›;›; BB: BUILD A BLOCK, WELL ALMOST›;›; ENTRY:A= DATA TO FILL WITH›; :X= LENTH OF BLOCK (0-> 256 BYTE›; EXIT:NONE›;›;**************************************›;›BBPROC›;›:LEN=$A1;LENTH OF SECTOR›;›STX:LEN›LDY#$00;INIT INDEX REGISTERS›LDX#$00›:LOOPSTA(BPNT),Y›JSRIBPNT;INCREMENT POINTER›INX›CPX:LEN;END OF BLOCK›BNE:LOOP›RTS›EPROC›;›;›;*************************************›;›; ANAL: ANALYZE A TRACK ON THE DISK›;›; ENTRY:AUX1 CONTAINS TRACK NUMBER›; EXIT:BUFFER OF 256 BYTES AT $2000›; :CONTAINS TRACK INFO›; :IN FOLLOWING FORMAT:›; TRACK NUMBER›; SIDE NUMBER›; SECTOR NUMBER›; SECTOR LENTH›; CRC1›; CRC2›; FDC STATUS REGISTER›;›; STATUS:00=NO ERROR›; :01=BAD TRACK NUMBER›; :02=TRACK BLANK›; :03=CAN'T COPE›;›;**************************************›;›ANLPROC›;›:STATUS=$A0›:TRYS=$AE;RETRY COUNT›:TEMP=$AF;TEMP SAVE AREA›:NSC1=$280C;NUM OF SECS FIRST PASS›:NSC2=$280D;NUM OF SECS SECND PASS›;›RDTME=$28C;READ TIMER ENABLE IQR›;›LDA#$20›STABPNT+1›LDA#0›STABPNT›LDA#2;CLEAR 2 PAGES›JSRZAB;ZERO ANL BUFFER›LDA#$FF›STATINB;INDICATE THAT TRACK BUFFER›;GOT YUCKED UP›LDADRA;GET OLD DATA REGISTER AND SAV›STA:TEMP›ORA#$20;PUT IN SINGLE DENSITY IF NOT›STADRA›JSRFINT;FRESH START›LDACMDFRM+2;GET TRACK NUMBER›STANTRK›JSRSKTK›BCC:AN001;NO ERROR CONTINUE›LDA#$01›STA:STATUS›JMP:ANXIT;GOODBY›;›:AN001LDA#$02›STA:TRYS;SET NUMBER OF RETRYS›:AN002JSRRADR;SEE IF ANYTHING ALIVE›BCC:AN003;OK WE HAVE SOMETHING HERE›DEC:TRYS;DEC RETRYS›BNE:AN002;KEEP GOING UNTIL GIVE UP›LDA#$02;BLANK TRACK OR SOMETHING›STA:STATUS›JMP:ANXIT›;›;NOW WE DO TRACK ANALYSIS›;TRY TO READ IN 26 SECTORS WORTH OF›;DATA, THEN REDUCE DATA TO FIND IDENT›;ENTRYS›;›;FORMAT OF DATA›;›; BYTE0:=TRACK ADDRESS›; BYTE1:=SIDE NUMBER›; BYTE2:=SECTOR ADDRESS›; BYTE3:=SECTOR LENTH›; BYTE4:=CRC1›; BYTE5:=CRC2›; BYTE6:=STATUS REGISTER›; BYTE7:=SECTOR TIME (K micro seconds)›;›:AN003LDA#$06›STA:TRYS;TRY SIX TIMES TO FIGURE›;OUT FORMAT OF TRACK›:AN009LDA#$00›STABPNT;SET UP BUFFER POINTER›LDA#$20›STABPNT+1›LDA#2;CLEAR 2 PAGES›JSRZAB›:AN007LDX#$00›LDY#$00›LDA#$CE;TIME FOR ONE TRACK AND A›;LITTLE BIT LESS›STAWT24E;START TIMER›;›;RECORD AS MANY SECTORS AS YOU CAN›;›:AN004JSRSRDA;DO SPECIAL READ ADRESS›BCC:AN005;OK NEXT SECTOR›JMP:AN006;GOODBY›;›:AN005LDA:STATUS›STA(BPNT),Y›INY›LDARDTME›STA(BPNT),Y›INY›JMP:AN004;NO›;›:AN006LDA:STATUS+1;CHECK NUMBER›BEQ:AN012;(ZERO BYTES OK TOO!)›CMP#6;OF BYTES READ›BEQ:AN012›;›JSRCLEAN;CLEAN UP LAST ENTRY›:AN012JSRFINT;TEMINATE OLD COMMAND›INCBPNT+1›LDABPNT+1›CMP#$22;BOTH BUFFERS FILLED?›BNE:AN007;›;›LDANTRK;GET TRACK NUMBER›LDX#$00›LDY#$20;ADDRESS OF FIRST BUFFER›JSRCKBF;CHECK BUFFER›LDA:STATUS›STA:NSC1;NUMBER OF SECTORS FOUND›;›LDANTRK›LDX#00›LDY#$21;ADDRESS OF SECOND BUFFER›JSRCKBF;CHECK THIS BUFFER TOO›LDA:STATUS›STA:NSC2›CMP:NSC1;ARE THEY EQUAL?›BEQ:AN008›:AN011DEC:TRYS›BNE:AN009;TRY SOME MORE›LDA#03›STA:STATUS›JMP:ANXIT›;›;OK NOW COMPARE THE TWO BUFFERS›;›:AN008LDA:NSC1;NUMBER OF SECTORS›STA$A4;PARAM2›LDA#$21›STA$A3;PARAM1›LDA#$00›LDX#$20›LDY#$00›JSRCMP›LDA:STATUS›BEQ:AN010›BNE:AN011›:AN010LDA:NSC1›STA:STATUS+1›LDA#$00›STA:STATUS›:ANXITRTS›;›EPROC›;›;›;**************************************›;›; SRDA: SPECIAL READ ADDRESS›;›; READ DISK ADDRESS›; RETURNS ADDRESS IN SIX BYTE BLOCK›; POINTED TO BY BPNT ON PAGE ZERO›; AND Y INDEX REGISTER›; STATUS REGISTER IN $A0›; NUMBER OF BYTES READ IN $A1›;›;**************************************›;›SRDAPROC›;›:STATUS=$A0›;›PHA;SAVE ACC›TXA›PHA›;THIS ROUTINE DOES NOT INIT THE›;TIMER, BUT DOES CHECK FOR TIMEOUT›;›:SRD10LDX#$00;INDEX OF BLOCK›LDA#$C0;LOAD READ ADRESS COMMAND›STACMDREG;›:SRD01BITDRA;WATCH DATA READY FLAG›BVC:SRD04›BPL:SRD01›LDADTAREG;READ DATA REGISTER›STA(BPNT),Y;STORE DATA›INY›INX›CPX#$06;SIX BYTES YET?›BNE:SRD01›LDA#$01›:SRD03BITSTREG›BNE:SRD03›LDASTREG›STA:STATUS›EOR#$FF›STASTAT+1›CLC›JMP:SRDXT›:SRD04SEC›LDARTDE;CLEAR TIMER›;›:SRDXTSTX:STATUS+1›PLA›TAX›PLA›RTS›;›;›;**************************************›;›; SPECIAL WRITE SECTOR›; WRITES DELEATED DATA MARK›; ENTRY:ACC=SECTOR TO WRITE›; :BUFFER POINTER POINTS TO DATA›; EXIT:CARRY SET IF ANY ERRORS›;›;**************************************›;›SWSPROC›;›:STATUS=$A0›;›STASECREG›LDATRACK›STATRKREG;SET UP SECTOR TO WRITE TO›:SWS01LDY#$00›LDX#$00›LDA#$E6›JSRSTMO›LDAWSDMCM;WRITE SECTOR COMMAND›;DELEATED DATA MARK›STACMDREG›:SWS02LDA(BPNT),Y›EOR#$FF;LOAD AND COMPLEMENT DATA›:SWS03BITDRA;CHECK FOR WHEN FDC REDY›BVC:SWS10;TIME OUT ERROR›BPL:SWS03;LOOP UNTIL READY›STADTAREG;SEND DATA TO FDC›LDAWT64D›INY›CPYLENTH;COMPARE WITH SECTOR LENTH›BNE:SWS02›LDA#$01›:SWS04BITSTREG›BNE:SWS04;LOOP UNTIL DONE›LDASTREG›LDA#0›STA:STATUS;SET STATUS OK!›CLC›RTS›:SWS10LDASTREG›AND#$01;CHECK FOR BUSY›BEQ:SWS20›LDA#$E6›JSRSTMO›BNE:SWS02›:SWS20LDAWT64D›LDASTREG›AND#$04;CHECK FOR LOST DATA›BNE:SWS01›LDASTREG›LDA#$01›STA:STATUS;SET STATUS YUCKY!›SEC›RTS›EPROC›;›;›;**************************************›;›; ZAB: ZERO BUFFER FOR ANL›;›; ENTRY:NUMBER OF PAGES CLEARED›; :BPNT POINTS TO START OF BUFF›; EXIT:PAGE(S) ZEROED›;›;**************************************›;›ZABPROC›;›:COUNT=$A0›;›STA:COUNT›LDABPNT;SAVE ORIGIANL BUFFER POINTER›PHA›LDABPNT+1›PHA›LDX#0›LDY#$00›TYA›:LOOPSTA(BPNT),Y›INY›BNE:LOOP›INCBPNT+1›INX›CPX:COUNT›BNE:LOOP›PLA;RECOVER BUFFER POINTER›STABPNT+1›PLA›STABPNT›RTS›EPROC›;›;**************************************›;›; CLEAN: CLEAN UP LAST ENTRY ON SEC MAP›;›; ENTRY:ACC=NUMBER OF BYTES LAST READ›; :BPNT=POINTER TO DATA›; :Y=INDEX TO DATA›;›;**************************************›;›CLEANPROC›;›:INDX=$2818›:N=$2819›:FINDX=$281A›;›STA:N›STY:INDX›LDA:INDX›LSRA›LSRA›LSRA›ASLA›ASLA›ASLA›STA:FINDX›LDY:FINDX›LDA#0›TAX›:LOOPSTA(BPNT),Y›INY›INX›CPX:N›BNE:LOOP›RTS›;›EPROC›;›LINKD2:DD15M6.ASM››